package io.awen.modules.sign.controller;

import io.awen.common.utils.PageUtils;
import io.awen.common.utils.R;
import io.awen.modules.sign.entity.SignFleetEntity;
import io.awen.modules.sign.qo.SignFleetQo;
import io.awen.modules.sign.service.SignFleetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;



/**
 * 收运单位车队信息表
 *
 * @author liu.wen
 * @email liu.wen@qq.com
 * @date 2022-08-10 00:47:08
 */
@RestController
@RequestMapping("sign/signfleet")
public class SignFleetController {
    @Autowired
    private SignFleetService signFleetService;

    /**
     * 列表
     */
    @PostMapping("/list")
//    @RequiresPermissions("sign:signfleet:list")
    public R list(@RequestBody SignFleetQo qo){
        PageUtils page = signFleetService.queryPage(qo);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//    @RequiresPermissions("sign:signfleet:info")
    public R info(@PathVariable("id") Long id){
		SignFleetEntity signFleet = signFleetService.getById(id);

        return R.ok().put("signFleet", signFleet);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
//    @RequiresPermissions("sign:signfleet:save")
    public R save(@RequestBody SignFleetEntity signFleet){
		signFleetService.save(signFleet);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
//    @RequiresPermissions("sign:signfleet:update")
    public R update(@RequestBody SignFleetEntity signFleet){
		signFleetService.updateById(signFleet);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
//    @RequiresPermissions("sign:signfleet:delete")
    public R delete(@RequestBody Long[] ids){
		signFleetService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
